package com.flnet.spsys.service;

import com.flnet.spsys.entity.User;
import com.flnet.spsys.mapper.UserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserService {
    String []users = {"demo","testuser","user"};

    @Autowired
    public UserMapper userMapper;

    public User selectByName(String userName){
        for (String user : users) {
            if (user.equals(userName)) {
                return new User();
            }
        }
        return null;
        //return userMapper.getUserByName(userName);
    }

    //注册
    public int insert(User user){
        return userMapper.insert(user);
    }


    public User selectByPrimaryKey(Integer id) {
        return userMapper.selectByPrimaryKey(id);
    }

}
